package org.geektimes.web.mvc.header;

import org.geektimes.web.mvc.header.matedata.ParamInfo;
import org.geektimes.web.mvc.header.matedata.WebContent;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* 缺省的解析器  
* @author : KangNing Hu
*/
public class DefaultParamParse extends AbstractParamParse {




	@Override
	protected Object parse0(WebContent webContent, ParamInfo paramInfo) {
		Class type = paramInfo.getType();

		if (type == HttpServletRequest.class || type == ServletRequest.class){
			return toHttp(webContent.getRequest());
		}
		if (type == HttpServletResponse.class || type == ServletResponse.class){
			return toHttp(webContent.getResponse());
		}
		if (type == WebContent.class){
			return webContent;
		}
		return null;
	}
}
